<?php
$huo =$_REQUEST["huo"];

$con =mysqli_connect("localhost","root", "", "cqhg");
mysqli_set_charset($con, "utf8");

if($huo=="1"){
	$ht =$_REQUEST["ht"];

	if($ht=="A"){
		$ho ="select * from user where hb='{$ht}' ";
		$hod =mysqli_query($con, $ho);
		$hodt=mysqli_fetch_all($hod,MYSQLI_ASSOC);
		$str =json_encode($hodt);
		echo $str;
	}
	if($ht=="B"){
		$ho ="select * from user where hb='{$ht}' limit 2";
		$hod =mysqli_query($con, $ho);
		$hodt=mysqli_fetch_all($hod,MYSQLI_ASSOC);
		$str =json_encode($hodt);
		echo $str;
	}
}	

if($huo=="2"){
	$hval =$_REQUEST["hval"];
			$st ="QWERTYUIOPASDFGHJKLZXCVBNM";
		$reg ="/{$hval}/i";
		$num =preg_match($reg,$st,$arr);
		if($num==0){
			
		$ho ="select * from user where name='{$hval}' ";
		$hod =mysqli_query($con, $ho);
		$hodt=mysqli_fetch_all($hod,MYSQLI_ASSOC);
		$str =json_encode($hodt);
		echo $str;
		}else{
			
		$ho ="select * from user where hb='{$hval}' ";
		$hod =mysqli_query($con, $ho);
		$hodt=mysqli_fetch_all($hod,MYSQLI_ASSOC);
		$str =json_encode($hodt);
		echo $str;
			
		}
		
	
	
		

	
}	

if($huo=="3"){
	$hb =$_REQUEST["hb"];

		$ho ="select * from user where hb='{$hb}' ";
		$hod =mysqli_query($con, $ho);
		$hodt=mysqli_fetch_all($hod,MYSQLI_ASSOC);
		$str =json_encode($hodt);
		echo $str;
	
	
}
if($huo=="4"){
	$c =$_REQUEST["c"];

		$ho ="select * from user where id='{$c}' ";
		$hod =mysqli_query($con, $ho);
		$hodt=mysqli_fetch_all($hod,MYSQLI_ASSOC);
		$str =json_encode($hodt);
		echo $str;
	
	
}
?>